]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
inputMethod: Check that there is an existing cursor location
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 9 Aug 2023 09:47:28 +0000 (11:47 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 9 Aug 2023 10:44:30 +0000 (12:44 +0200)
Commit 17d9ec5788fb made the input method call update() more eagerly,
but also at times that it does not have a cursor position yet. Make
it bail out correctly in that situation.

Fixes: 17d9ec5788fb ("inputMethod: Keep Capabilite.FOCUS before context.focus_in/focus_out")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2876>

js/misc/inputMethod.js

index d944c29784f6949dd2ef24230591f8b5775772e2..9f16597588e6750868a5fd5e409017a849e87d4d 100644 (file)
@@ -380,9 +380,11 @@ export const InputMethod = GObject.registerClass({
             return;
         this._updateCapabilities();
         this._context.set_content_type(this._purpose, this._hints);
-        this._context.set_cursor_location(
-            this._cursorRect.x, this._cursorRect.y,
-            this._cursorRect.width, this._cursorRect.height);
+        if (this._cursorRect) {
+            this._context.set_cursor_location(
+                this._cursorRect.x, this._cursorRect.y,
+                this._cursorRect.width, this._cursorRect.height);
+        }
         this._emitRequestSurrounding();
     }
 });